<template>
  <view class="content">
    <u-checkbox-group
              size="15px"
              @change="checkboxChange"
              v-model="checkboxValue1"
              placement="row">
              <u-checkbox
              labelSize="14px"
                :customStyle="{marginBottom: '10px'}"
                v-for="(item, index) in checkboxList1"
                :key="index"
                :label="item.name"
                :name="item.value"
              ></u-checkbox>
            </u-checkbox-group>
  </view>
</template>

<script>
  
  export default {
    props:['search'],
    data() {
      return {
        checkboxValue1:this.search,
        checkboxList1: [
          {
            name: '物体打击',
            value: '1'
          },
          {
            name: '车辆伤害',
            value: '2'
          },
          {
            name: '机械伤害',
            value: '3'
          },
          {
            name: '起重伤害',
            value: '4'
          },
          {
            name: '触电',
            value: '5'
          },
          {
            name: '淹溺',
            value: '6'
          },
          {
            name: '灼烫',
            value: '7'
          },
          {
            name: '火灾',
            value: '8'
          },
          {
            name: '高处坠落',
            value: '9'
          },
          {
            name: '坍塌',
            value: '10'
          },
          {
            name: '冒顶片帮',
            value: '11'
          },
          {
            name: '透水',
            value: '12'
          },
          {
            name: '放炮',
            value: '13'
          },
          {
            name: '火药爆炸',
            value: '14'
          },
          {
            name: '瓦斯爆炸',
            value: '15'
          },
          {
            name: '锅炉爆炸',
            value: '16'
          },
          {
            name: '容器爆炸',
            value: '17'
          },
          {
            name: '其它爆炸',
            value: '18'
          },
          {
            name: '中毒和窒息',
            value: '19'
          },
          {
            name: '其它伤害',
            value: '20'
          },
        ],
      }
    },
    beforeUpdate(){
      console.log(this.search)
      console.log(this.checkboxValue1)
    },
    // onLoad(options) {
    //   if(options.id) this.getDangerDetail({id: options.id})
    // },
    methods: {
      checkboxChange(item){
        console.log(item)
        // console.log(this.checkboxValue1)
        this.$emit('itemclick', item)
      }
    }

  }
</script>



<style lang="scss" scoped>
.content {
    /deep/ .u-checkbox-group {
      flex-wrap: wrap;
    }
    /deep/ .u-checkbox{
      width: 33%;
    }
  }
 
</style>
